﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using Castle.DynamicProxy;
using FunnyFace.Common;
using TCSmartFramework.DataAccess;

namespace CastleDynamicProxy
{
    class Program
    {
        private static Func<int, int, bool> com;

        public static void Test()
        {
           //var str =  DatabaseFactory.EncryptSqlConnection("192.168.0.169,1440;User ID=admin_17u_com;Password=sf!7%5eI3X;Initial Catalog=TCHotelResource;");
           //Database db =  DatabaseFactory.GetReadDatabase("TCHotelResource");
            using (SqlConnection conn = new SqlConnection(@"Data Source='192.168.2.55,2433';Initial Catalog='TCWorkDocument';User ID='TCHotelSwitch';Password='M@SYv7%vCp&amp;2E';"))
            {
                conn.Open();
                var i = 0;
            }

        }


        



        static void Main(string[] args)
        {
            FTPHelper ftp = new FTPHelper("221.231.139.48", "", "zhangq", "ZQ190388");

            //ftp.Upload(@"D:\1.txt");


            ftp.Download("e:", "1.txt");


            IList<string> files = ftp.GetFilesDetailList();
            foreach (var file in files)
            {
                Console.WriteLine(file);
            }
            //try
            //{
            //    Test();
            //    ProxyGenerator generator = new ProxyGenerator();
            //    MyInterceptor interceptor = new MyInterceptor();

            //    UserProcessor userprocessor = generator.CreateClassProxy<UserProcessor>(interceptor);
            //    User user = new User() { Name = "lee", PassWord = "123123123123" };
            //    userprocessor.RegUser(user);
            //}
            //catch (Exception ex)
            //{
            //    //throw ex;

            //    Console.WriteLine(ex.Message);
            //    Console.WriteLine(ex.StackTrace);
            //} 
            Console.ReadLine();
        }
    }


    public interface IUserProcessor
    {
        void RegUser(User user);
    }

    public class UserProcessor : IUserProcessor
    {
        public virtual void RegUser(User user)
        {
            Console.WriteLine("用户已注册。Name:{0},PassWord:{1}", user.Name, user.PassWord);
        }
    }


    public class User
    {

        public string Name { get; set; }


        public string PassWord { get; set; }
    }


}
